<template>
	<view class="content">
		<view class="bottom">
			<template v-if="article.length>0">
				<view class="menu-block list-item" @click="navigate(index)" v-for="(item,index) in article" :key="item.id">
					<view class="article-info">
						<view class="title">{{item.title}}</view>
						<view class="time">{{item.createTime}}</view>
					</view>
				</view>
			</template>
			<view v-else style="text-align: center;">
				暂无数据
			</view>
		</view>
		
	</view>
</template>

<script>
	import {
		getNewsList
	} from '@/api/policy.js';
	export default {
		data() {
			return {
				userType:null,
				id: 0,
				page: 1,
				limit: 10,
				type: 1,
				topBgColor: 'rgba(0,0,0,0)',
				info: [],
				article: [],
			}
		},
		methods: {
			navigate1(url) {
				uni.navigateTo({
					url
				})
			},
			navigate(index) {
				const item = this.article[index];
				uni.navigateTo({
					url: `/page_other/project_right/policy/detail?id=${item.id}`
					// url: '/pages/index/detail?id=1'
				})
			},
			getList(type) {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				getNewsList({
					page: this.page,
					limit: this.limit,
					type: type,
				}).then(data => {
					uni.hideLoading()
					this.article = data.list
				}).catch(() => {
					uni.hideLoading()
				})
			},
		},
		onLoad(e) {
			this.id = e.id
			this.getList(this.id);
		},
		watch: { //监听
			noticeActive: {
				handler(type) {
					console.log(type)
					this.getList(type);
				},
				//immediate:true,//深度监听
			},
		},
		
	}
</script>

<style scoped lang="scss">
	
	.bottom{
		width: 100%;
		background: #F8F8F8;
		border-radius: 50rpx 50rpx 0 0;
		padding-top: 30rpx;
		min-width: 100rpx;
		.menu-block {
			display: flex;
			width: 92%;
			margin: 0 30rpx 30rpx 30rpx;
			background: #fff;
			border-radius: 12px;
			padding: 30rpx;
		}
		.list-item {
			display: flex;
			padding-bottom: 30rpx;
			border-bottom: 1px solid #efefef;
			// margin-top: 30rpx;
			
			.cover {
				width: 150rpx;
				height: 150rpx;
				border-radius: 12px;
				margin-right: 20rpx;
			}
			
			.article-info {
				width: 100%;
			
				.title {
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 2;
					font-size: 32rpx;
					color: #1A1A1A;
					// font-family: 'FangZhengHanZhenGuangBiaoJianTi';
					line-height: 52rpx;
				}
			
				.time {
					margin-top: 20rpx;
					font-size: 28rpx;
					color: #767676;
					width: 160rpx;
					height: 40rpx;
					overflow: hidden;
				}
			}
		}
	}
		
	
		// .list-item:last-child {
		// 	border-bottom: none;
		// 	padding-bottom: 0;
		// }
</style>